<?php
// +----------------------------------------------------------------------
// | 跃飞 [ 将来的你一定会感激现在奋斗的自己 ]
// +----------------------------------------------------------------------
// | Author: 钟贵廷
// +----------------------------------------------------------------------
// | URI1: https://gitee.com/yeafy   URI2:https://github.com/gtzhong
// +----------------------------------------------------------------------
// | weChat:gt845272922  qq:845272922
// +----------------------------------------------------------------------

namespace app\home\controller;
use think\Config;
use think\Controller;
use think\Db;

class OracleTest extends Controller
{
    /**
     * 描述:这是测试mysql数据库的
     * @author 钟贵廷
     * @WeChat gt845272922
     * @qq 845272922
     */
    public function test()
    {
        $user = Db::name('user')->select();
        p($user);
    }

    /**
     * 描述:在控制器中使用oracle
     * @author 钟贵廷
     * @WeChat gt845272922
     * @qq 845272922
     */
    public function test2()
    {
        //读取配置文件database.php文件下的oracle配置
        $config = Config::get('oracle');
        $user = Db::connect($config)->name('user')->select();
        p($user);
    }

    /**
     * 描述:在模型中使用oracle
     * @author 钟贵廷
     * @WeChat gt845272922
     * @qq 845272922
     */
    public function test3()
    {
        $testModel = model('User');
        $testModel->select();
    }
}